package utility;

public class Piece extends Sprite {
	public static final int STATECHESS_NOMAL = 1;
	public static final int STATECHESS_ACTIVE = 2;
	public static final int STATECHESS_MOVE = 3;
	private Position Position;
	private int index;
	private int state;

	public Piece() {
		super();
		Position = null;
		state = STATECHESS_NOMAL;
		index = -1;
	}

	public Piece(Piece piece) {
		this.setIndex(piece.getIndex());
		this.setPosition(piece.getPosition());
		this.setSprite(piece.getSprite());
		this.setState(piece.getState());
	}

	public void move(Position dest) {
		this.setPosition(dest);
	}

	public Position getPosition() {
		return Position;
	}

	public void setPosition(Position mPosition) {
		this.Position = mPosition;
		this.setxPost(this.Position.getxPost());
		this.setyPost(this.Position.getyPost());
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}

	public boolean compare(Piece pi) {
		return this.getPosition().compare(pi.getPosition())
				&& this.getIndex() == pi.getIndex()
				&& this.getState() == pi.getState();
	}
}
